package com.java.control.search;

import org.apache.commons.lang.StringUtils;

/**
 * 人员
 * @author wqf
 * @version  Nov 24, 2011 11:55:45 AM
 */
public class SupplierQuotationSearchCond extends SearchCond{
	
	private String userName;
	private Long productId;
	private String productNo;
	private Long supplierId;
	private String supplierName;
	

	public ConditionPart getCondition(){
		ConditionPart cp=new ConditionPart();
		StringBuffer searchStr=new StringBuffer(" 1=1");
		if(StringUtils.isNotBlank(searchWord)){
			searchStr.append(" and (supplier.companyName like ? or product.productNo like ?)");
			cp.getParams().add("%"+searchWord.trim()+"%");
			cp.getParams().add("%"+searchWord.trim()+"%");
		}
		if(StringUtils.isNotBlank(userName)){
			searchStr.append(" and userName like ?");
			cp.getParams().add("%"+userName+"%");
		}
		if(null!=productId){
			searchStr.append(" and product.id=?");
			cp.getParams().add(productId);
		}
		if(StringUtils.isNotBlank(productNo)){
			searchStr.append(" and product.productNo=?");
			cp.getParams().add(productNo);
		}
		if(null!=supplierId){
			searchStr.append(" and supplier.id=?");
			cp.getParams().add(supplierId);
		}
		if(StringUtils.isNotBlank(supplierName)){
			searchStr.append(" and supplier.companyName like ?");
			cp.getParams().add("%"+supplierName+"%");
		}
		cp.setExpression(searchStr.toString());
		return cp;
	}


	public String getUserName() {
		return userName;
	}


	public void setUserName(String userName) {
		this.userName = userName;
	}


	public Long getProductId() {
		return productId;
	}


	public void setProductId(Long productId) {
		this.productId = productId;
	}


	public Long getSupplierId() {
		return supplierId;
	}


	public void setSupplierId(Long supplierId) {
		this.supplierId = supplierId;
	}


	public String getSupplierName() {
		return supplierName;
	}


	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}


	public String getProductNo() {
		return productNo;
	}


	public void setProductNo(String productNo) {
		this.productNo = productNo;
	}

}
